package com.woniuxy.myshop.config;


import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport;

import java.lang.reflect.Method;

@Configuration
public class MyGenerateKeyConfig {


    @Bean(value = "wugd")
    public KeyGenerator keyGenerator(){
        return new KeyGenerator() {
            @Override
            public Object generate(Object target, Method method, Object... params) {
                String  s = "" ;
                if (params != null && params.length > 0){
                    for (Object o :params) {
                        s += o ;
                    }
                }
                return target.getClass() + method.getName() + s ;
            }
        } ;
    }
}
